<template>
  <div class="exhibits-content" :style="{ width: props.info.width + 'rem', height: props.info.height + 'rem' }">
    <div class="list">
      <div
        class="decoration-box"
        :style="{
          backgroundImage: `url(${publicUrls + 'free/style5/exhibitionStandStyle3bg4.webp'})`,
        }"
      ></div> 
      <div class="list-content">
        <div
          class="list-left"
          :style="{
            backgroundImage: `url(${publicUrls + 'free/style5/exhibitionStandStyle3bg1.webp'})`,
          }"
        ></div>
        <div
          @contextmenu.stop="emit('onContextMenuChild', $event, index)"
          v-for="(item, index) in props.info.showpieceList"
          :key="index"
          :style="{
            backgroundImage: `url(${publicUrls + 'free/style5/exhibitionStandStyle3bg2.webp'})`,
          }"
          class="exhibits-item"
        >
          <div class="item-content"  @click="viewImg(item.moduleId, item.id)">
            <div class="cover-parent">
              <div class="cover-box">
              <img
                class="cover"
                v-lazy="getLinkUrl(item.coverUrl, '?imageView2/3/w/600/format/webp')"
                alt=""
               
              />
              <FlowerCom />
            </div>
            </div>
            

            <div class="items-title">
              <p class="items-title-content">{{ item.name }}</p>
            </div>
          </div>
        </div>
        <div
          class="list-right"
          :style="{
            backgroundImage: `url(${publicUrls + 'free/style5/exhibitionStandStyle3bg3.webp'})`,
          }"
        ></div>
      </div>
    </div>
  </div>
</template> 
 
<script setup lang="ts">
import FlowerCom from '../../displayBoard/style5/flower.vue';
import { publicUrls } from '@/utils/minxin';
import { DraggableContainer } from 'vue3-draggable-resizable';
// import FlotMenu from '@/components/flotMenu/OutlineMenu.vue';
import ContextMenu from '@imengyu/vue3-context-menu';
import { getDraggableNumber, getExhibitsHeightRest, getdisabledY } from '@/utils/getRemComputed';
import { ref, reactive, watch, nextTick } from 'vue';
import { exbitMenuShow, exbitListMenuShow } from '@/hooks/menuHooks';
import { useProjectStore } from '@/store';
import { getLinkUrl } from '@/utils/request/upload';

const emit = defineEmits([
  'emitChildItemDraggable',
  'emitChildItemDraggableStyle',
  'emitShowcaseDraggable',
  'emitShowcaseDraggableStyle',
  'onContextMenuChild',
]);
const store = useProjectStore();
const contextMenuTrigger = ref(); //列表盒子dom
const parentLock = ref(true);
const childShow = ref(true);
const draggableResizable = ref(); //父级拖拽盒子ref
const timer = ref();
const ImgVisible = ref(false);
const ImgUrl = ref('');

const props = defineProps({
  width: {
    type: Number || String,
  },
  height: {
    type: Number || String,
  },
  indexs: {
    type: Number,
  },
  info: {
    type: Object,
  },
  childId: {
    type: Number,
  },
  AuxiliaryId: {
    type: Number,
  },
});

const viewImg = (moduleId: number, e?: number) => {
  store.exhibitsModuleId = moduleId;
  store.exhibitsShowpieceid = e;
  store.exhibitsInfoShow = true;
};

const handleMouseDown = (event) => {
  event.stopPropagation();
};
const preventDefaultDrag = (event) => {
  event.stopPropagation();
};
// watch(
//   () => props.info.width,
//   () => {
//     childShow.value = false;
//     nextTick(() => {
//       childShow.value = true;
//     });
//   },
//   { deep: true },
// );
// watch(
//   () => props.info.height,
//   () => {
//     childShow.value = false;
//     nextTick(() => {
//       childShow.value = true;
//     }); 
//   },
//   { deep: true },
// );
//
</script>
   
<style lang="less" scoped>
.exhibits-content {
  position: relative;
  display: flex;
  z-index: 999;
  padding: 0 !important;
  -webkit-box-reflect: below 46% linear-gradient(transparent, rgba(0, 0, 0, 0.3));
}
.list {
  display: flex;
  width: 100%;
  height: 100%;
}
.list-content {
  display: flex;
  margin-top: 56px;
}
.list-left, 
.list-right {
  width: 250px;
  height: 620px;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  -webkit-box-reflect: below 0% linear-gradient(transparent, rgba(0, 0, 0, 0.3));
}
.decoration-box {
  width: 240px;
  height: 289px;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  margin-right: 100px;
}
.active {
  :deep(.flot-menu) {
    display: flex;
  }
}
:deep(.active) {
  z-index: 999;
}
:deep(.vdr-handle) {
  z-index: 66;
}

.exhibits-item {
  display: flex;
  flex-direction: column;
  position: relative;
  width: 310px;
  height: 620px;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  -webkit-box-reflect: below 0% linear-gradient(transparent, rgba(0, 0, 0, 0.3));
}

.item-content {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 200px;
  height: 198px;
  margin-top: 204px;
  margin-left: 57px;
}
.cover-parent {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 200px;
  height: 198px;
  border-left: 1px solid #7fa399;
  border-right: 1px solid #7fa399;
}

.cover-box { 
  position: relative;
  width: 198px; 
  height: 198px;
  overflow: hidden;
  background: rgba(245, 246, 242, 1);
}
.cover {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: all 0.3s;
}

.items-title {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  padding: 75px 10px;
  opacity: 0;
  width: 200px;
  height: 199px;
  border-left: 1px solid #7fa399;
  border-right: 1px solid #7fa399;
  background: rgba(64, 109, 98, 0.58);
  .items-title-content {
    width: 100%;
    max-height: 48px;
    font-family: SourceHanSerifCN-Bold;
    font-size: 18px;
    color: rgba(245, 246, 242, 1);
    line-height: 24px;
    text-align: center;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2; /* 限制显示的文本行数为2 */
    overflow: hidden; /* 隐藏超出部分 */
    text-overflow: ellipsis; /* 使用省略号表示被截断的文本 */
  }
}
.item-content:hover {
  .items-title {
    opacity: 1;
  }
   :deep(.flower-btn){
    display: none;
  }
}
</style>
